import { Component } from '@angular/core';
import { NavController,NavParams,AlertController } from 'ionic-angular';
import { HttpService } from '../../../providers/http.service';
import { CommonFunc } from '../../../providers/commonFunc';
import { Storage } from '@ionic/storage';
import { RepairDetailPage } from '../repair-detail/repair-detail';
/**
 * 维修待确认列表
 */
@Component({
  templateUrl: 'repair-list.html'
})
export class RepairListPage {
  private list : any;
  private currentPartyId:any;
  constructor(
    public navCtrl: NavController,
    private alertCtrl: AlertController,
    private httpService: HttpService,
    private navParams: NavParams,
    private commonFunc: CommonFunc,
    private storage: Storage
  ) {

    this.storage.get('user').then((data)=>{
        this.currentPartyId = data.partyId;
        // let observable2 = this.httpService.queryUsedRepairList(
        //   { partyId: this.currentPartyId }
        // );
        // observable2.subscribe( data => {
        //   if(data.status==200){
        //     this.list = data.data.list;
        //   }
    
        // });
    })
  }

  ionViewDidEnter(){
    let observable2 = this.httpService.queryUsedRepairList(
      { partyId: this.currentPartyId }
    );
    observable2.subscribe( data => {
      if(data.status==200){
        this.list = data.data.list;
      }

    });
  }

  toDetail(item){
    this.navCtrl.push(RepairDetailPage,{repairInfo:item});
  }


}
